﻿//-------------------------------------------------------------------------------------------------------------------------------------
// Copyright (C) 2005 greatelsoft.com All Rights Reserved
//-------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Data.Common;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Web.UI;
using Pub.Class;
using GTS.Channel.Api.Entity;
using GTS.Channel.Api.Helper;

namespace GTS.Channel.Api {
    /// <summary>
    /// SMSMO
    /// </summary>
    public class SMSMO : PageBase {
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e) {
            Base.RunJob();
            ISMSIVR mo = Base.ISMSIVR();
            if (mo.IsNull()) { Base.WriteLog("Error1"); mo.Output(ResultEnum.Error); }
            ChannelDealData data = mo.GetSMSMOData();
            if (data.IsNull()) { Base.WriteLog("Error2"); mo.Output(ResultEnum.Error); }
            Base.WriteLogUrl(data.SPCode);
            ResultEnum res = ChannelDealDataHelper.UpdateAndInsert(data, "ConnString") ? ResultEnum.Success : ResultEnum.Error;
            mo.Output(res);
        }
    }
    /// <summary>
    /// SMSMT
    /// </summary>
    public class SMSMT : PageBase {
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e) {
            Base.RunJob();
            ISMSIVR mt = Base.ISMSIVR();
            if (mt.IsNull()) { Base.WriteLog("Error1"); mt.Output(ResultEnum.Error); }
            ChannelDealData data = mt.GetSMSMTData();
            if (data.IsNull()) { Base.WriteLog("Error2"); mt.Output(ResultEnum.Error); }
            Base.WriteLogUrl(data.SPCode);
            ResultEnum res = ChannelDealDataHelper.UpdateAndInsert(data, "ConnString") ? ResultEnum.Success : ResultEnum.Error;
            mt.Output(res);
        }
    }
    /// <summary>
    /// SMSMR
    /// </summary>
    public class SMSMR : PageBase {
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e) {
            Base.RunJob();
            ISMSIVR mr = Base.ISMSIVR();
            if (mr.IsNull()) { //Base.WriteLog("Error1"); 
                mr.Output(ResultEnum.Error); 
            }
            ChannelDealData data = mr.GetSMSMRData();
            if (data.IsNull()) { //Base.WriteLog("Error2"); 
                mr.Output(ResultEnum.Error); 
            }
            Base.WriteLogUrl(data.SPCode);
            ResultEnum res = ChannelDealDataHelper.UpdateAndInsert(data, "ConnString") ? ResultEnum.Success : ResultEnum.Error;
            mr.Output(res);
        }
    }
    /// <summary>
    /// IVRMR
    /// </summary>
    public class IVRMR : PageBase {
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e) {
            Base.RunJob();
            ISMSIVR ivrmr = Base.ISMSIVR();
            if (ivrmr.IsNull()) { Base.WriteLog("Error1"); ivrmr.Output(ResultEnum.Error); }
            IVRDealData data = ivrmr.GetIVRMRData();
            if (data.IsNull()) { Base.WriteLog("Error2"); ivrmr.Output(ResultEnum.Error); }
            Base.WriteLogUrl(data.SPCode);
            ResultEnum res = IVRDealDataHelper.UpdateAndInsert(data, "ConnString") ? ResultEnum.Success : ResultEnum.Error;
            ivrmr.Output(res);
        }
    }
}

